<?php
class helper{
	public function CMail($Email){
		$e_e="/^([a-zA-Z0-9_\-\.\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/";
		if(preg_match($e_e,$Email)==1){
			return true;
		}else{
			return false;
		}
	}
	//检查是否为一个手机
	public function CPhone($e){
			$e_e="/^(1\\d{10})$/";
			if(preg_match($e_e,$e)==1){
				return true;
			}else{
				return false;
			}
	}
	public function CURL($str){
		$e_e="/^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/";
		if(preg_match($e_e,$str)==1){
			return true;
		}else{
			return false;
		}
	}
	public function uniquestr($len=16){
		return substr(md5(uniqid('',TRUE)),0,$len);
	}
	public function SMessage($time,$go,$style,$msg,$script=false){
		if($script){$go="javascript:history.go(-1);";}
		$this->yum->set(array('time'=>$time,'go'=>$go,'style'=>$style,'message'=>$msg,'script'=>$script));
		$this->yum->view('view/message.php');
	}
}
?>